<template>
    <el-card class="contanier">
        <div slot="header" class="clearfix">
            <span>用户留言</span>
        </div>
        <div>
            <div v-for="(item, index) in worddata" :key="item.id" class="box">
                <div class="top">
                    <div class="img">
                        <img
                            src="https://img1.baidu.com/it/u=4256350010,1509363888&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400" />
                    </div>
                    <div class="right">
                        <div class="name">{{ item.username }}</div>
                        <div class="date">{{ item.date }}</div>
                    </div>
                    <el-button @click="godelede(item)" text type="warning">删除</el-button>
                </div>
                <div class="center">
                    {{ item.content }}
                </div>
            </div>
        </div>
    </el-card>
</template>

<script>

import { getworddata } from "@/api/word";

export default {
    data() {
        return {
            worddata: []
        }
    },
    mounted() {
        this.initdata()
    },
    methods: {
        async initdata() {
            let result = await getworddata();
            if (result.status == 0) {
                this.worddata = result.data
                console.log(result.data);
            }
        }
    }
}
</script>

<style scoped>
.contanier {
    margin: 30px;
    width: 45%;

}
</style>